Q: How do I make command line arguments work the same in the environment and a standalone executable?
A:  Programs call XstGetCommandLineArguments (@argc, @arvg$[]) to get command line arguments. But the command line arguments a standalone executable will receive are not available to the program when it is run in the environment. To test the effect of various command line arguments on a program in the environment, you need code like the following:

'
'  ...
'
XstGetApplicationEnvironment (@standalone, 0)
'
IF standalone THEN
XstGetCommandLineArguments (@argc, @argv$[])
ELSE
argc = 3
DIM argv$[2]
argv$[0] = "progname.exe"
argv$[1] = "foobar.dat"
argv$[2] = "-flag"
END IF
'
' code that processes command line arguments in argv$[]
'

This code executes the first part of the IF block when the program is run as a standalone executable, and the second part when the program is run in the PDE. A standalone program will thus take its command line arguments from the command line, while the same program run in the environment will take its command line arguments from those explicitly defined in the second part of the IF block. If you'll be doing lots of command line argument testing, you could write a fancier second part of the IF block to input accept a variable number of arguments from the console each time the program is run.

Alternatively XstSetCommandLineArguments (argc, @argv$[]) sets the command line arguments.

The following code returns the original command line arguments, even after they have been changed.

argc = -1
XstGetCommandLineArguments (@argc, @argv$[])

The following code reinstates the original command line arguments after they have been changed.

argc = -1
XstGetCommandLineArguments (@argc, @argv$[])
XstSetCommandLineArguments (argc, @argv$[])